<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;
//前台默认控制器
class IndexController extends Controller{
	//构造函数
	public function __init()
	{
	}
	
    //首页展示
    public function index(){
    	//获得分类
    	$cateModel = new \Common\Model\Cate;
		$cateData = $cateModel->where('pid',0)->orderBy('cid','ASC')->limit(15)->get();
		//分配数据
		View::with('cateData',$cateData);

		$data = $cateModel->orderBy('cid','ASC')->get();
		$data = Data::channelLevel($data, $pid = 0, $html = "&nbsp;", $fieldPri = 'cid', $fieldPid = 'pid', $level = 1);
		//分配数据
		View::with('data',$data);
		//p($data[1]['cid']);
		
		//获得顶级分类
		$topCate = Db::table('category')->where("pid=0")->get();
		View::with('topCate',$topCate);
		
       View::make();
    }
	

}
